package mua.core.operation.basis;

import mua.core.interpreter.Global;
import mua.core.value.Bool;
import mua.core.value.FunctionBody;
import mua.core.value.MuaValue;

public class IsName {
    public static MuaValue run(MuaValue a, FunctionBody functionBody){
        boolean flag = true;
        if(functionBody==null){
            if(Global.globalVariable.get(a.toString())==null){
                flag = false;
            }
        }else {
            if(functionBody.getLocalVariable().get(a.toString())==null&&Global.globalVariable.get(a.toString())==null){
                flag = false;
            }
        }
        if(flag){
            return new Bool("true");
        }else{
            return new Bool("false");
        }
    }
}
